package api

import (
	"rank/pkg/schema"

	"github.com/gin-gonic/gin"
)

// Hello godoc
//
//	@Summary		问候
//	@Tags			Hello
//	@Description	get greet by name
//	@Accept			json
//	@Produce		json
//	@Param			name			path		string									true	"libz"
//	@Param			Content-Type	header		string									true	"application/json"	default(application/json)
//	@Success		200				{object}	schema.Response{data=schema.HelloRsp}	"响应体"
//	@Router			/v1/hello/{name} [get]
func (c *restHandler) Hello(ctx *gin.Context) {
	data, err := c.dao.Hello(ctx.Request.Context(), ctx.Param("name"))
	if err != nil {
		c.respDesc(ctx, -1, err.Error())
		return
	}

	rsp := &schema.HelloRsp{Greet: data}
	c.respData(ctx, rsp)
}
